package com.ssy.lingxi.contract.model.bo.sign;

import cn.hutool.core.convert.NumberChineseFormatter;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

/**
 * 订单BO
 * @author yzc
 * @version 2.0.0
 * @date 2021/1/8
 */
@Data
public class OrderBO {

    /**
     * 商品金额合计
     */
    private BigDecimal productAmount;
    /**
     * 商品金额合计(大写)
     */
    private String productAmountWord;
    /**
     * 运费金额合计
     */
    private BigDecimal freightAmount;
    /**
     * 运费金额合计(大写)
     */
    private String freightAmountWord;
    /**
     * 订单总额金额合计
     */
    private BigDecimal totalAmount;
    /**
     * 订单总额金额合计(大写)
     */
    private String totalAmountWord;

    /**
     * 订单商品明细
     */
    private List<OrderProductBO> orderProductList;

    public String getProductAmountWord() {
        return Objects.isNull(productAmount) ? "" : NumberChineseFormatter.format(productAmount.doubleValue(), true, true);
    }


    public String getFreightAmountWord() {
        return Objects.isNull(freightAmount) ? "" : NumberChineseFormatter.format(freightAmount.doubleValue(), true, true);
    }


    public String getTotalAmountWord() {
        return Objects.isNull(totalAmount) ? "" : NumberChineseFormatter.format(totalAmount.doubleValue(), true, true);
    }
}
